/**
 * Block rendering utils
 */

export const renderBlocks = ({max, amount}) => {
  amount = Math.max(0, amount);
  const numBlocks = Math.ceil(max / 4);
  if (amount === max) {
    return '█'.repeat(numBlocks);
  }
  const solid = Math.floor(amount / 4);
  const rem = amount % 4;
  return '█'.repeat(solid) + " ░▒▓"[rem] + '.'.repeat(numBlocks-solid-1);
};
